package com.Logistics.pddispatch.task;

import com.Logistics.pddispatch.service.BusinessOperationService;
import com.Logistics.pddispatch.service.TaskOrderClassIfyService;
import com.Logistics.pddispatch.service.TaskRoutePlanningService;
import com.Logistics.pddispatch.service.TaskTripsSchedulingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 只能调度组件
 */
@Slf4j
@Component("dispatchTask")
public class DispatchTask {
    @Autowired
    private TaskOrderClassIfyService taskOrderClassIfyService;
    @Autowired
    private TaskRoutePlanningService taskRoutePlanningService;
    @Autowired
    private BusinessOperationService businessOperationService;
    @Autowired
    private TaskTripsSchedulingService taskTripsSchedulingService;

    /**
     * 智能调度
     * @param businessId 网点ID
     * @param prams 规则
     * @param jobId 任务ID
     * @param jobLogId 任务日志ID
     */
    public void run(String businessId,String prams,String jobId,String jobLogId){
        //智能调度开始执行
        log.info("定时任务开始执行------参数是,{},{},{},{}",businessId,prams,jobId,jobLogId);

//        //订单分类
//        List<OrderClassifyGroupDTO> orderClassifyGroupDTOS = this.taskOrderClassIfyService.execute(businessId,jobId,jobLogId);
//        System.out.println(orderClassifyGroupDTOS);
//
//        //线路规划
//        List<OrderLineSimpleDTO> lineSimpleDTOS = this.taskRoutePlanningService.execute(orderClassifyGroupDTOS,businessId,jobId,jobLogId,prams);
//
//        //创建运输任务
//        Map<String, TaskTransportDto> transportDtoMap = this.businessOperationService.createTransportOrderTask(lineSimpleDTOS);
//
//        //安排车次车辆司机
//        List<OrderLineTripsTruckDriverDTO> tripsTruckDriverDTOList  =
//                this.taskTripsSchedulingService.execute(lineSimpleDTOS,businessId,jobId,jobLogId,prams );
//
//        //完善运输任务信息添加司机作业信息
//        this.businessOperationService.updateTransportTask(tripsTruckDriverDTOList,transportDtoMap);
    }
}
